<script lang="ts" setup>
import { ref } from "vue";

const dataList = ref<any>([
  {
    name: "首页轮播图",
  },
  {
    name: "首页轮播图",
  },
]);

const modalVisible = ref(false);

const handleAction = (action: string) => {
  if (action === "add") {
    modalVisible.value = true;
  }
};
</script>

<template>
  <umrp-container :gap="16" bg-color="#f2f2f2" height="100%" padding="16px">
    <umrp-breadcrumb :items="['广告管理', '广告位置']"></umrp-breadcrumb>
    <umrp-card :border="false">
      <umrp-table :action-bar="true" :data="dataList" @action="handleAction">
        <template #columns>
          <umrp-table-column title="序号" data-index="id" :width="80"></umrp-table-column>
          <umrp-table-column title="广告位置" data-index="name"></umrp-table-column>
          <umrp-table-column slot-name="action" title="操作" :width="160"></umrp-table-column>
        </template>
        <template #action>
          <umrp-space :size="10">
            <umrp-button @click="modalVisible = true" type="primary">编辑</umrp-button>
            <umrp-popconfirm message="您确认删除么？">
              <umrp-button type="danger">删除</umrp-button>
            </umrp-popconfirm>
          </umrp-space>
        </template>
        <template #img>
          <umrp-image :height="80" :width="80"></umrp-image>
        </template>
      </umrp-table>
    </umrp-card>
  </umrp-container>
  <umrp-modal v-model:visible="modalVisible" width="500px">
    <umrp-container padding="16px 0">
      <umrp-form>
        <umrp-form-item label="广告位置">
          <umrp-input></umrp-input>
        </umrp-form-item>
      </umrp-form>
    </umrp-container>
  </umrp-modal>
</template>
